package com.itheima.enums;

import lombok.Getter;

/**
 * 用户角色
 *
 * @author wangjian
 * @date 2022/3/2 16:00
 */
@Getter
public enum UserRoleEnum {

    /**
     * 校对人：Checked
     * 审核人：Verified
     * 审定人：Approved
     * 项目经理：PrjManager
     * 设计部门负责人：DesignDeptChief
     * 设计主持人：DesignChief
     * 专业负责人：DiscipLineChief
     * 设计制图人：DraftingDesigner
     */
    Checked("校对人", "Checked"),
    Verified("审核人", "Verified"),
    Approved("审定人", "Approved"),
    PrjManager("项目经理", "PrjManager"),
    DesignDeptChief("设计部门负责人", "DesignDeptChief"),
    DeptChief("部门负责人", "DesignDeptChief"),
    DesignChief("设计主持人", "DesignChief"),
    FirstDesignChief("第一设计主持人", "DesignChief"),
    DiscipLineChief("专业负责人", "DiscipLineChief"),
    DraftingDesigner("设计制图人", "DraftingDesigner"),
    Designer("设计人", "DraftingDesigner"),
    PrLeader("部门领导","PrLeader"),
    SysteManager("系统管理员","SysteManager"),
    MainDepManager("主管部门领导","MainDepManager"),
    Dean("相关院领导","Dean"),
    Initiator("发起人","Initiator"),
    ProjectPersonnel("项目相关人员","ProjectPersonnel"),
    ChapterPersonnel("注册章人员","ChapterPersonnel"),
    InfoOfficePersonnel("信息化办公室人员","InfoOfficePersonnel")

    ;

    private final String name;
    private final String value;

    UserRoleEnum(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public static String getValueByName(String name) {
        for (UserRoleEnum roleEnum : UserRoleEnum.values()) {
            if (roleEnum.name.equals(name)) {
                return roleEnum.value;
            }
        }
        return null;
    }

    public static String getValueByNameOrDefault(String name, String defaultValue) {
        String valueByName = getValueByName(name);
        if (valueByName == null) {
            return defaultValue;
        }
        return valueByName;
    }

    public static void main(String[] args) {

        String value = UserRoleEnum.InfoOfficePersonnel.getValue();
        System.out.println(value);
    }
}
